#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void solve()
{
    int n;
    cin >> n;
    int i = 0;
    vector<int> a(n + 10);
    vector<bool> ba(n + 10);
    for (i = 1; i <= n; i++)
    {
        a[i] = i;
        ba[i] = false;
    }
    int j = 0;
    for (i = 1; i <= n; i++)
    {
        if (!ba[i])
        {
            cout << a[i] << ' ';
            ba[i] = true;
            int temp = 2 * a[i];
            while (temp <= a[n])
            {
                if (!ba[temp])
                {
                    cout << a[temp] << ' ';
                    ba[temp] = true;
                    temp = 2 * a[temp];
                }
                else
                    break;
            }
        }
    }
    cout << endl;
}
int main()
{
    int t = 0;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
